package com.nari.ies.ne.nw.server.service.fileDataCheck.impl;

import com.nari.ies.ne.nw.server.entity.FileDataCheckEntity;
import com.nari.ies.ne.nw.server.mapper.FileDataCheckMapper;
import com.nari.ies.ne.nw.server.mapper.PlantDataMapper;
import com.nari.ies.ne.nw.server.service.fileDataCheck.IQXHJFileDataCheckService;
import com.nari.ies.ne.nw.server.util.DataUtil;
import com.nari.ies.ne.nw.server.util.IoUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import static com.nari.ies.ne.nw.server.util.DataUtil.queryTime;

@Service
@Slf4j
public class QXHJFileDataCheckServiceImpl implements IQXHJFileDataCheckService {

    @Autowired
    private PlantDataMapper plantDataMapper;
    @Autowired
    private FileDataCheckMapper fileDataCheckMapper;

    @Override
    public void FDQXHJFileDataCheck(File file) {
        log.info("数据评分--------------------" + file.getName());
        FileDataCheckEntity fileDataCheckEntity;
        List<FileDataCheckEntity> dataList = new ArrayList<>();
        String plantId;//场站id
        Date forecastDate = null;//预测时间
        Date createDate = new Date();//创建时间
        String plantType;//场站类型
        String fileType;//文件类型
        String dataType;//字段类型
        int longitudeNoData = 0;//升压站经度无数据
        int longitudeQualifiedData = 0;//升压站经度合格数据(有数据且合格)
        int longitudeUnqualifiedData = 0;//升压站经度不合格数据(有数据但不合格)
        int latitudeNoData = 0;//升压站纬度无数据
        int latitudeQualifiedData = 0;//升压站纬度合格数据(有数据且合格)
        int latitudeUnqualifiedData = 0;//升压站纬度不合格数据(有数据但不合格)
        int normalCapacityNoData = 0;//正常发电有功容量无数据
        int normalCapacityQualifiedData = 0;//正常发电有功容量合格数据(有数据且合格)
        int normalCapacityUnqualifiedData = 0;//正常发电有功容量不合格数据(有数据但不合格)
        int normalNumberNoData = 0;//正常发电台数无数据
        int normalNumberQualifiedData = 0;//正常发电台数合格数据(有数据且合格)
        int normalNumberUnqualifiedData = 0;//正常发电台数不合格数据(有数据但不合格)
        int plannedCapacityNoData = 0;//计划检修发电容量无数据
        int plannedCapacityQualifiedData = 0;//计划检修发电容量合格数据(有数据且合格)
        int plannedCapacityUnqualifiedData = 0;//计划检修发电容量不合格数据(有数据但不合格)
        int plannedNumberNoData = 0;//计划检修台数无数据
        int plannedNumberQualifiedData = 0;//计划检修台数合格数据(有数据且合格)
        int plannedNumberUnqualifiedData = 0;//计划检修台数不合格数据(有数据但不合格)
        int limitedCapacityNoData = 0;//限电有功容量无数据
        int limitedCapacityQualifiedData = 0;//限电有功容量合格数据(有数据且合格)
        int limitedCapacityUnqualifiedData = 0;//限电有功容量不合格数据(有数据但不合格)
        int limitedNumberNoData = 0;//限电台数无数据
        int limitedNumberQualifiedData = 0;//限电台数合格数据(有数据且合格)
        int limitedNumberUnqualifiedData = 0;//限电台数不合格数据(有数据但不合格)
        int standbyCapacityNoData = 0;//待机有功容量无数据
        int standbyCapacityQualifiedData = 0;//待机有功容量合格数据(有数据且合格)
        int standbyCapacityUnqualifiedData = 0;//待机有功容量不合格数据(有数据但不合格)
        int standbyNumberNoData = 0;//待机台数无数据
        int standbyNumberQualifiedData = 0;//待机台数合格数据(有数据且合格)
        int standbyNumberUnqualifiedData = 0;//待机台数不合格数据(有数据但不合格)
        int interruptCapacityNoData = 0;//通讯中断容量无数据
        int interruptCapacityQualifiedData = 0;//通讯中断容量合格数据(有数据且合格)
        int interruptCapacityUnqualifiedData = 0;//通讯中断容量不合格数据(有数据但不合格)
        int interruptNumberNoData = 0;//通讯中断台数无数据
        int interruptNumberQualifiedData = 0;//通讯中断台数合格数据(有数据且合格)
        int interruptNumberUnqualifiedData = 0;//通讯中断台数不合格数据(有数据但不合格)
        int unplannedCapacityNoData = 0;//非计划停运有功容量无数据
        int unplannedCapacityQualifiedData = 0;//非计划停运有功容量合格数据(有数据且合格)
        int unplannedCapacityUnqualifiedData = 0;//非计划停运有功容量不合格数据(有数据但不合格)
        int unplannedNumberNoData = 0;//非计划停运台数无数据
        int unplannedNumberQualifiedData = 0;//非计划停运台数合格数据(有数据且合格)
        int unplannedNumberUnqualifiedData = 0;//非计划停运台数不合格数据(有数据但不合格)
        int temperature10mNoData = 0;//10米环境温度无数据
        int temperature10mQualifiedData = 0;//10米环境温度合格数据(有数据且合格)
        int temperature10mUnqualifiedData = 0;//10米环境温度不合格数据(有数据但不合格)
        int humidity10mNoData = 0;//10米空气相对湿度无数据
        int humidity10mQualifiedData = 0;//10米空气相对湿度合格数据(有数据且合格)
        int humidity10mUnqualifiedData = 0;//10米空气相对湿度不合格数据(有数据但不合格)
        int pressure10mNoData = 0;//10米气压无数据
        int pressure10mQualifiedData = 0;//10米气压合格数据(有数据且合格)
        int pressure10mUnqualifiedData = 0;//10米气压不合格数据(有数据但不合格)
        int windSpeed10mNoData = 0;//10米风速无数据
        int windSpeed10mQualifiedData = 0;//10米风速合格数据(有数据且合格)
        int windSpeed10mUnqualifiedData = 0;//10米风速不合格数据(有数据但不合格)
        int windDirection10mNoData = 0;//10米风向无数据
        int windDirection10mQualifiedData = 0;//10米风向合格数据(有数据且合格)
        int windDirection10mUnqualifiedData = 0;//10米风向不合格数据(有数据但不合格)
        int windSpeed30mNoData = 0;//30米风速无数据
        int windSpeed30mQualifiedData = 0;//30米风速合格数据(有数据且合格)
        int windSpeed30mUnqualifiedData = 0;//30米风速不合格数据(有数据但不合格)
        int windDirection30mNoData = 0;//30米风向无数据
        int windDirection30mQualifiedData = 0;//30米风向合格数据(有数据且合格)
        int windDirection30mUnqualifiedData = 0;//30米风向不合格数据(有数据但不合格)
        int windSpeed50mNoData = 0;//50米风速无数据
        int windSpeed50mQualifiedData = 0;//50米风速合格数据(有数据且合格)
        int windSpeed50mUnqualifiedData = 0;//50米风速不合格数据(有数据但不合格)
        int windDirection50mNoData = 0;//50米风向无数据
        int windDirection50mQualifiedData = 0;//50米风向合格数据(有数据且合格)
        int windDirection50mUnqualifiedData = 0;//50米风向不合格数据(有数据但不合格)
        int windSpeed70mNoData = 0;//70米风速无数据
        int windSpeed70mQualifiedData = 0;//70米风速合格数据(有数据且合格)
        int windSpeed70mUnqualifiedData = 0;//70米风速不合格数据(有数据但不合格)
        int windDirection70mNoData = 0;//70米风向无数据
        int windDirection70mQualifiedData = 0;//70米风向合格数据(有数据且合格)
        int windDirection70mUnqualifiedData = 0;//70米风向不合格数据(有数据但不合格)
        int hubSpeedNoData = 0;//风机轮毂风速无数据
        int hubSpeedQualifiedData = 0;//风机轮毂风速合格数据(有数据且合格)
        int hubSpeedUnqualifiedData = 0;//风机轮毂风速不合格数据(有数据但不合格)
        int hubDirectionNoData = 0;//风机轮毂风向无数据
        int hubDirectionQualifiedData = 0;//风机轮毂风向合格数据(有数据且合格)
        int hubDirectionUnqualifiedData = 0;//风机轮毂风向不合格数据(有数据但不合格)


        String tableName = "HISDB.NW_NE_FILE_DATACHECK_FD_QXHJ";//表名
        // 总体信息分类
        int ztxxCount = 0;
        // 气象环境分类
        int qxhjCount = 0;

        // 文件名称 FD_GD.GDZJFSFD_CDQYC_20230612_073000.dat
        String fileName = file.getName();

        String[] fileNameArr = fileName.split("_");
        // 文件类型
        fileType = fileNameArr[2];
        // 场站类型
        plantType = fileNameArr[0];
        // 场站标识
        String plantCode = fileNameArr[1].split("\\.")[1];

        //String nwCode = fileNameArr[0] + "_" + fileNameArr[1].split("\\.")[0] + ".";
        List<Map<String, Object>> idList = plantDataMapper.selectPlantData(plantCode);

        plantId = idList.get(0).get("ID").toString();
        if (plantId.contains("-")) {
            plantId = plantId.split("-")[0];
        }

        FileReader fr = null;
        BufferedReader br = null;
        try {
            fr = new FileReader(file);
            br = new BufferedReader(fr);
            // 读取到的每一行数据
            String line = "";

            while ((line = br.readLine()) != null) {
                // 预测时间标签行
                if (line.contains("<ZTXX::")) {
                    ztxxCount = 1;
                    forecastDate = queryTime(line);
                }

                if (line.contains("</ZTXX::")) {
                    ztxxCount = 0;
                }

                if (line.contains("<QXHJ::")) {
                    qxhjCount = 1;
                }

                if (line.contains("</QXHJ::")) {
                    qxhjCount = 0;
                }
                String[] strs = line.split("\t");

                // 数据行
                if (line.contains("#") && ztxxCount == 1) {

                    // 升压站经度
                    if (!("null".equals(strs[2]) || " ".equals(strs[2]) || "NULL".equals(strs[2]))) {
                        longitudeQualifiedData++;
                    }
                    // 升压站纬度
                    if (!("null".equals(strs[3]) || " ".equals(strs[3]) || "NULL".equals(strs[3]))) {
                        latitudeQualifiedData++;
                    }
                    // 正常发电有功容量
                    if (!("null".equals(strs[4]) || " ".equals(strs[4]) || "NULL".equals(strs[4]))) {
                        if (Float.parseFloat(strs[4]) >= 0) {
                            normalCapacityQualifiedData++;
                        }
                    }
                    // 发电台数
                    if (!("null".equals(strs[6]) || " ".equals(strs[6]) || "NULL".equals(strs[6]))) {
                        if (Float.parseFloat(strs[6]) >= 0) {
                            normalNumberQualifiedData++;
                        }
                    }
                    // 计划检修有功容量
                    if (!("null".equals(strs[7]) || " ".equals(strs[7]) || "NULL".equals(strs[7]))) {
                        if (Float.parseFloat(strs[7]) >= 0) {
                            plannedCapacityQualifiedData++;
                        }
                    }
                    // 计划检修台数
                    if (!("null".equals(strs[9]) || " ".equals(strs[9]) || "NULL".equals(strs[9]))) {
                        if (Float.parseFloat(strs[9]) >= 0) {
                            plannedNumberQualifiedData++;
                        }
                    }
                    // 限电有功容量
                    if (!("null".equals(strs[10]) || " ".equals(strs[10]) || "NULL".equals(strs[10]))) {
                        if (Float.parseFloat(strs[10]) >= 0) {
                            limitedCapacityQualifiedData++;
                        }
                    }
                    // 限电台数
                    if (!("null".equals(strs[12]) || " ".equals(strs[12]) || "NULL".equals(strs[12]))) {
                        if (Float.parseFloat(strs[12]) >= 0) {
                            limitedNumberQualifiedData++;
                        }
                    }
                    // 待机有功容量
                    if (!("null".equals(strs[13]) || " ".equals(strs[13]) || "NULL".equals(strs[13]))) {
                        if (Float.parseFloat(strs[13]) >= 0) {
                            standbyCapacityQualifiedData++;
                        }
                    }
                    // 待机台数
                    if (!("null".equals(strs[15]) || " ".equals(strs[15]) || "NULL".equals(strs[15]))) {
                        if (Float.parseFloat(strs[15]) >= 0) {
                            standbyNumberQualifiedData++;
                        }
                    }
                    // 通讯中断有功容量
                    if (!("null".equals(strs[16]) || " ".equals(strs[16]) || "NULL".equals(strs[16]))) {
                        if (Float.parseFloat(strs[16]) >= 0) {
                            interruptCapacityQualifiedData++;
                        }
                    }
                    // 通讯中断台数
                    if (!("null".equals(strs[18]) || " ".equals(strs[18]) || "NULL".equals(strs[18]))) {
                        if (Float.parseFloat(strs[18]) >= 0) {
                            interruptNumberQualifiedData++;
                        }
                    }
                    // 非计划停运有功容量
                    if (!("null".equals(strs[19]) || " ".equals(strs[19]) || "NULL".equals(strs[19]))) {
                        if (Float.parseFloat(strs[19]) >= 0) {
                            unplannedCapacityQualifiedData++;
                        }
                    }
                    // 非计划停运台数
                    if (!("null".equals(strs[21]) || " ".equals(strs[21]) || "NULL".equals(strs[21]))) {
                        if (Float.parseFloat(strs[21]) >= 0) {
                            unplannedNumberQualifiedData++;
                        }
                    }
                }
                if (line.contains("#") && qxhjCount == 1) {
                    // 10米环境温度
                    if (!("null".equals(strs[2]) || " ".equals(strs[2]) || "NULL".equals(strs[2]))) {
                        if (Float.parseFloat(strs[2]) >= -20 && Float.parseFloat(strs[2]) <= 60) {
                            temperature10mQualifiedData++;
                        }
                    }
                    // 10米空气相对湿度
                    if (!("null".equals(strs[3]) || " ".equals(strs[3]) || "NULL".equals(strs[3]))) {
                        if (Float.parseFloat(strs[3]) >= 0 && Float.parseFloat(strs[3]) <= 100) {
                            humidity10mQualifiedData++;
                        }
                    }
                    // 10米气压
                    if (!("null".equals(strs[4]) || " ".equals(strs[4]) || "NULL".equals(strs[4]))) {
                        if (Float.parseFloat(strs[4]) >= 0) {
                            pressure10mQualifiedData++;
                        }
                    }
                    // 10米风速
                    if (!("null".equals(strs[5]) || " ".equals(strs[5]) || "NULL".equals(strs[5]))) {
                        if (Float.parseFloat(strs[5]) >= 0 && Float.parseFloat(strs[5]) <= 100) {
                            windSpeed10mQualifiedData++;
                        }
                    }
                    // 10米风向
                    if (!("null".equals(strs[6]) || " ".equals(strs[6]) || "NULL".equals(strs[6]))) {
                        if (Float.parseFloat(strs[6]) >= 0 && Float.parseFloat(strs[6]) <= 360) {
                            windDirection10mQualifiedData++;
                        }
                    }
                    // 30米风速
                    if (!("null".equals(strs[7]) || " ".equals(strs[7]) || "NULL".equals(strs[7]))) {
                        if (Float.parseFloat(strs[7]) >= 0 && Float.parseFloat(strs[7]) <= 100) {
                            windSpeed30mQualifiedData++;
                        }

                    }
                    // 30米风向
                    if (!("null".equals(strs[8]) || " ".equals(strs[8]) || "NULL".equals(strs[8]))) {
                        if (Float.parseFloat(strs[8]) >= 0 && Float.parseFloat(strs[8]) <= 360) {
                            windDirection30mQualifiedData++;
                        }
                    }
                    // 50米风速
                    if (!("null".equals(strs[9]) || " ".equals(strs[9]) || "NULL".equals(strs[9]))) {
                        if (Float.parseFloat(strs[9]) >= 0 && Float.parseFloat(strs[9]) <= 100) {
                            windSpeed50mQualifiedData++;
                        }
                    }
                    // 50米风向
                    if (!("null".equals(strs[10]) || " ".equals(strs[10]) || "NULL".equals(strs[10]))) {
                        if (Float.parseFloat(strs[10]) >= 0 && Float.parseFloat(strs[10]) <= 360) {
                            windDirection50mQualifiedData++;
                        }
                    }
                    // 70米风速
                    if (!("null".equals(strs[11]) || " ".equals(strs[11]) || "NULL".equals(strs[11]))) {
                        if (Float.parseFloat(strs[11]) >= 0 && Float.parseFloat(strs[11]) <= 100) {
                            windSpeed70mQualifiedData++;
                        }
                    }
                    // 70米风向
                    if (!("null".equals(strs[12]) || " ".equals(strs[12]) || "NULL".equals(strs[12]))) {
                        if (Float.parseFloat(strs[12]) >= 0 && Float.parseFloat(strs[12]) <= 360) {
                            windDirection70mQualifiedData++;
                        }
                    }
                    // 轮毂风速
                    if (!("null".equals(strs[13]) || " ".equals(strs[13]) || "NULL".equals(strs[13]))) {
                        if (Float.parseFloat(strs[13]) >= 0 && Float.parseFloat(strs[13]) <= 100) {
                            hubSpeedQualifiedData++;
                        }
                    }
                    // 轮毂风向
                    if (!("null".equals(strs[14]) || " ".equals(strs[14]) || "NULL".equals(strs[14]))) {
                        if (Float.parseFloat(strs[14]) >= 0 && Float.parseFloat(strs[14]) <= 360) {
                            hubDirectionQualifiedData++;
                        }
                    }
                }
            }

            // 升压站经度
            dataType = "longitude";
            // 升压站经度不合格
            longitudeUnqualifiedData = 1 - longitudeQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, longitudeNoData, longitudeQualifiedData, longitudeUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 升压站纬度
            dataType = "latitude";
            // 升压站纬度不合格
            latitudeUnqualifiedData = 1 - latitudeQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, latitudeNoData, latitudeQualifiedData, latitudeUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            //正常发电有功容量
            dataType = "normalCapacity";
            // 正常发电有功容量不合格
            normalCapacityUnqualifiedData = 1 - normalCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, normalCapacityNoData, normalCapacityQualifiedData, normalCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 正常发电台数
            dataType = "normalNumber";
            // 正常发电台数不合格
            normalNumberUnqualifiedData = 1 - normalNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, normalNumberNoData, normalNumberQualifiedData, normalNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 计划检修发电容量
            dataType = "plannedCapacity";
            // 计划检修发电容量不合格
            plannedCapacityUnqualifiedData = 1 - plannedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, plannedCapacityNoData, plannedCapacityQualifiedData, plannedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            //计划检修台数
            dataType = "plannedNumber";
            // 计划检修台数不合格
            plannedNumberUnqualifiedData = 1 - plannedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, plannedNumberNoData, plannedNumberQualifiedData, plannedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 限电有功容量
            dataType = "limitedCapacity";
            // 限电有功容量不合格
            limitedCapacityUnqualifiedData = 1 - limitedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, limitedCapacityNoData, limitedCapacityQualifiedData, limitedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 限电台数
            dataType = "limitedNumber";
            // 限电台数不合格
            limitedNumberUnqualifiedData = 1 - limitedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, limitedNumberNoData, limitedNumberQualifiedData, limitedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 待机有功容量
            dataType = "standbyCapacity";
            // 待机有功容量不合格
            standbyCapacityUnqualifiedData = 1 - standbyCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, standbyCapacityNoData, standbyCapacityQualifiedData, standbyCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            //待机台数
            dataType = "standbyNumber";
            // 待机台数不合格
            standbyNumberUnqualifiedData = 1 - standbyNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, standbyNumberNoData, standbyNumberQualifiedData, standbyNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 通讯中断容量
            dataType = "interruptCapacity";
            // 通讯中断容量不合格
            interruptCapacityUnqualifiedData = 1 - interruptCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, interruptCapacityNoData, interruptCapacityQualifiedData, interruptCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 通讯中断台数
            dataType = "interruptNumber";
            // 通讯中断台数不合格
            interruptNumberUnqualifiedData = 1 - interruptNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, interruptNumberNoData, interruptNumberQualifiedData, interruptNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 非计划停运有功容量
            dataType = "unplannedCapacity";
            // 非计划停运有功容量不合格
            unplannedCapacityUnqualifiedData = 1 - unplannedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, unplannedCapacityNoData, unplannedCapacityQualifiedData, unplannedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            //非计划停运台数
            dataType = "unplannedNumber";
            // 非计划停运台数不合格
            unplannedNumberUnqualifiedData = 1 - unplannedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, unplannedNumberNoData, unplannedNumberQualifiedData, unplannedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10米环境温度
            dataType = "temperature10m";
            // 10米环境温度不合格
            temperature10mUnqualifiedData = 1 - temperature10mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, temperature10mNoData, temperature10mQualifiedData, temperature10mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10米空气相对湿度
            dataType = "humidity10m";
            // 10米空气相对湿度不合格
            humidity10mUnqualifiedData = 1 - humidity10mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, humidity10mNoData, humidity10mQualifiedData, humidity10mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10米气压
            dataType = "pressure10m";
            // 10米气压不合格
            pressure10mUnqualifiedData = 1 - pressure10mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, pressure10mNoData, pressure10mQualifiedData, pressure10mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10米风速
            dataType = "windSpeed10m";
            // 10米风速不合格
            windSpeed10mUnqualifiedData = 1 - windSpeed10mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windSpeed10mNoData, windSpeed10mQualifiedData, windSpeed10mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10米风向
            dataType = "windDirection10m";
            // 10米风向不合格
            windDirection10mUnqualifiedData = 1 - windDirection10mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windDirection10mNoData, windDirection10mQualifiedData, windDirection10mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 30米风速
            dataType = "windSpeed30m";
            // 30米风速不合格
            windSpeed30mUnqualifiedData = 1 - windSpeed30mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windSpeed30mNoData, windSpeed30mQualifiedData, windSpeed30mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 30米风向
            dataType = "windDirection30m";
            // 30米风向不合格
            windDirection30mUnqualifiedData = 1 - windDirection30mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windDirection30mNoData, windDirection30mQualifiedData, windDirection30mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 50米风速
            dataType = "windSpeed50m";
            // 50米风速不合格
            windSpeed50mUnqualifiedData = 1 - windSpeed50mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windSpeed50mNoData, windSpeed50mQualifiedData, windSpeed50mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 50米风向
            dataType = "windDirection50m";
            // 50米风向不合格
            windDirection50mUnqualifiedData = 1 - windDirection50mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windDirection50mNoData, windDirection50mQualifiedData, windDirection50mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 70米风速
            dataType = "windSpeed70m";
            // 70米风速不合格
            windSpeed70mUnqualifiedData = 1 - windSpeed70mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windSpeed70mNoData, windSpeed70mQualifiedData, windSpeed70mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 70米风向
            dataType = "windDirection70m";
            // 70米风向不合格
            windDirection70mUnqualifiedData = 1 - windDirection70mQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, windDirection70mNoData, windDirection70mQualifiedData, windDirection70mUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 风机轮毂风速
            dataType = "hubSpeed";
            // 风机轮毂风速不合格
            hubSpeedUnqualifiedData = 1 - hubSpeedQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, hubSpeedNoData, hubSpeedQualifiedData, hubSpeedUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 风机轮毂风向
            dataType = "hubDirection";
            // 风机轮毂风向不合格
            hubDirectionUnqualifiedData = 1 - hubDirectionQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, hubDirectionNoData, hubDirectionQualifiedData, hubDirectionUnqualifiedData);
            dataList.add(fileDataCheckEntity);


            int data = fileDataCheckMapper.selectFileDataCheck(plantId, forecastDate, tableName);
            if (data == 0) {
                log.info("数据评分插入--------------"+fileName);
                fileDataCheckMapper.insertFileDataCheck(dataList, tableName);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IoUtil.close(br);
            IoUtil.close(fr);
        }
    }

    @Override
    public void GFQXHJFileDataCheck(File file) {
        log.info("数据评分--------------------"+file.getName());
        FileDataCheckEntity fileDataCheckEntity ;
        List<FileDataCheckEntity> dataList = new ArrayList<>();
        String plantId ;//场站id
        Date forecastDate = null;//预测时间
        Date createDate = new Date();//创建时间
        String plantType;//场站类型
        String fileType;//文件类型
        String dataType;//字段类型

        // 1.升压站经度
        int longitudeNoData = 0;//升压站经度无数据
        int longitudeQualifiedData = 0;//升压站经度合格数据(有数据且合格)
        int longitudeUnqualifiedData = 0;//升压站经度不合格数据(有数据但不合格)

        // 2.升压站纬度
        int latitudeNoData = 0;//升压站纬度无数据
        int latitudeQualifiedData = 0;//升压站纬度合格数据(有数据且合格)
        int latitudeUnqualifiedData = 0;//升压站纬度不合格数据(有数据但不合格)

        // 3.正常发电容量
        int normalCapacityQualifiedData = 0;//正常发电有功容量合格数据(有数据且合格)
        int normalCapacityUnqualifiedData = 0;//正常发电有功容量不合格数据(有数据但不合格)
        int normalCapacityNoData = 0;//正常发电台数无数据

        // 4.计划检修有功容量
        int plannedCapacityNoData = 0;//计划检修发电容量无数据
        int plannedCapacityQualifiedData = 0;//计划检修发电容量合格数据(有数据且合格)
        int plannedCapacityUnqualifiedData = 0;//计划检修发电容量不合格数据(有数据但不合格)

        // 5.计划检修台数
        int plannedNumberNoData = 0;//计划检修台数无数据
        int plannedNumberQualifiedData = 0;//计划检修台数合格数据(有数据且合格)
        int plannedNumberUnqualifiedData = 0;//计划检修台数不合格数据(有数据但不合格)

        // 6.限电有功容量
        int limitedCapacityNoData = 0;//限电有功容量无数据
        int limitedCapacityQualifiedData = 0;//限电有功容量合格数据(有数据且合格)
        int limitedCapacityUnqualifiedData = 0;//限电有功容量不合格数据(有数据但不合格)

        // 7.限电台数
        int limitedNumberNoData = 0;//限电台数无数据
        int limitedNumberQualifiedData = 0;//限电台数合格数据(有数据且合格)
        int limitedNumberUnqualifiedData = 0;//限电台数不合格数据(有数据但不合格)

        // 8.待机有功容量
        int standbyCapacityNoData = 0;//待机有功容量无数据
        int standbyCapacityQualifiedData = 0;//待机有功容量合格数据(有数据且合格)
        int standbyCapacityUnqualifiedData = 0;//待机有功容量不合格数据(有数据但不合格)

        // 9.待机台数
        int standbyNumberNoData = 0;//待机台数无数据
        int standbyNumberQualifiedData = 0;//待机台数合格数据(有数据且合格)
        int standbyNumberUnqualifiedData = 0;//待机台数不合格数据(有数据但不合格)

        // 10.通讯中断有功容量
        int interruptCapacityNoData = 0;//通讯中断容量无数据
        int interruptCapacityQualifiedData = 0;//通讯中断容量合格数据(有数据且合格)
        int interruptCapacityUnqualifiedData = 0;//通讯中断容量不合格数据(有数据但不合格)

        // 11.通讯中断台数
        int interruptNumberNoData = 0;//通讯中断台数无数据
        int interruptNumberQualifiedData = 0;//通讯中断台数合格数据(有数据且合格)
        int interruptNumberUnqualifiedData = 0;//通讯中断台数不合格数据(有数据但不合格)

        // 12.非计划停运有功容量
        int unplannedCapacityNoData = 0;//非计划停运有功容量无数据
        int unplannedCapacityQualifiedData = 0;//非计划停运有功容量合格数据(有数据且合格)
        int unplannedCapacityUnqualifiedData = 0;//非计划停运有功容量不合格数据(有数据但不合格)

        // 13.非计划停运台数
        int unplannedNumberNoData = 0;//非计划停运台数无数据
        int unplannedNumberQualifiedData = 0;//非计划停运台数合格数据(有数据且合格)
        int unplannedNumberUnqualifiedData = 0;//非计划停运台数不合格数据(有数据但不合格)

        // 14.全站实时出力
        int poweraLLNoData = 0;//无数据
        int poweraLLQualifiedData = 0;//有数据且合格
        int poweraLLQualifiedDataNo = 0;//有数据但不合格

        // 15.全站可控容量
        int controlCapacityNoData = 0;//无数据
        int controlCapacityQualifiedData = 0;//有数据且合格
        int controlCapacityQualifiedDataNo = 0;//有数据但不合格

        // 16.全站理论有功
        int theoryPowerNoData = 0;//无数据
        int theoryPowerQualifiedData = 0;//有数据且合格
        int theoryPowerQualifiedDataNo = 0;//有数据但不合格

        // 17.总辐射
        int totalRadioNoData = 0;//无数据
        int totalRadioQualifiedData = 0;//有数据且合格
        int totalRadioQualifiedDataNo = 0;//有数据但不合格

        // 18.直射
        int directRadioNoData = 0;//无数据
        int directRadioQualifiedData = 0;//有数据且合格
        int directRadioQualifiedDataNo = 0;//有数据但不合格

        // 19.散射
        int scatterRadioNoData = 0;//无数据
        int scatterRadioQualifiedData = 0;//有数据且合格
        int scatterRadioQualifiedDataNo = 0;//有数据但不合格

        // 20.温度
        int temperNoData = 0;//无数据
        int temperQualifiedData = 0;//有数据且合格
        int temperQualifiedDataNo = 0;//有数据但不合格

        // 21.压力
        int pressNoData = 0;//无数据
        int pressQualifiedData = 0;//有数据且合格
        int pressQualifiedDataNo = 0;//有数据但不合格

        // 22.湿度
        int humidityNoData = 0;//无数据
        int humidityQualifiedData = 0;//有数据且合格
        int humidityQualifiedDataNo = 0;//有数据但不合格

        // 23.风速
        int speedNoData = 0;//无数据
        int speedQualifiedData = 0;//有数据且合格
        int speedQualifiedDataNo = 0;//有数据但不合格

        // 24.风向
        int directionNoData = 0;//无数据
        int directionQualifiedData = 0;//有数据且合格
        int directionQualifiedDataNo = 0;//有数据但不合格

        // 25.光伏组件温度
        int pvModuleTemperNoData = 0;//无数据
        int pvModuleTemperQualifiedData = 0;//有数据且合格
        int pvModuleTemperQualifiedDataNo = 0;//有数据但不合格

        String tableName = "HISDB.NW_NE_FILE_DATACHECK_GF_QXHJ";//表名
        // 总体信息分类
        int ztxxCount = 0;
        // 气象环境分类
        int qxhjCount = 0;

        // 文件名称 FD_GD.GDZJFSFD_CDQYC_20230612_073000.dat
        String fileName = file.getName();

        String[] fileNameArr = fileName.split("_");
        // 文件类型
        fileType = fileNameArr[2];
        // 场站类型
        plantType = fileNameArr[0];
        // 场站标识
        String plantCode = fileNameArr[1].split("\\.")[1];

        //String nwCode = fileNameArr[0] + "_" + fileNameArr[1].split("\\.")[0] + ".";
        List<Map<String, Object>> idList = plantDataMapper.selectPlantData(plantCode);

        plantId = idList.get(0).get("ID").toString();
        if (plantId.contains("-")) {
            plantId = plantId.split("-")[0];
        }

        FileReader fr = null;
        BufferedReader br = null;
        try {
            fr = new FileReader(file);
            br = new BufferedReader(fr);
            // 读取到的每一行数据
            String line = "";

            while ((line = br.readLine()) != null) {
                // 预测时间标签行
                if (line.contains("<ZTXX::")) {
                    ztxxCount = 1;
                    forecastDate = DataUtil.queryTime(line);
                }

                if (line.contains("</ZTXX::")) {
                    ztxxCount = 0;
                }

                if (line.contains("<QXHJ::")) {
                    qxhjCount = 1;
                }

                if (line.contains("</QXHJ::")) {
                    qxhjCount = 0;
                }
                String[] strs = line.split("\t");

                // 数据行
                if (line.contains("#") && ztxxCount == 1){
                    // 升压站经度
                    if (!("null".equals(strs[2]) || " ".equals(strs[2]) || "NULL".equals(strs[2]))) {
                        longitudeQualifiedData++;
                    }
                    // 升压站纬度
                    if (!("null".equals(strs[3]) || " ".equals(strs[3]) || "NULL".equals(strs[3]))) {
                        latitudeQualifiedData++;
                    }
                    // 正常发电有功容量
                    if (!("null".equals(strs[4]) || " ".equals(strs[4]) || "NULL".equals(strs[4]))) {
                        if (Float.parseFloat(strs[4]) >= 0) {
                            normalCapacityQualifiedData++;
                        }
                    }
                    // 计划检修有功容量
                    if (!("null".equals(strs[7]) || " ".equals(strs[7]) || "NULL".equals(strs[7]))) {
                        if (Float.parseFloat(strs[7]) >= 0) {
                            plannedCapacityQualifiedData++;
                        }
                    }
                    // 计划检修台数
                    if (!("null".equals(strs[9]) || " ".equals(strs[9]) || "NULL".equals(strs[9]))) {
                        if (Float.parseFloat(strs[9]) >= 0) {
                            plannedNumberQualifiedData++;
                        }
                    }
                    // 限电有功容量
                    if (!("null".equals(strs[10]) || " ".equals(strs[10]) || "NULL".equals(strs[10]))) {
                        if (Float.parseFloat(strs[10]) >= 0) {
                            limitedCapacityQualifiedData++;
                        }
                    }
                    // 限电台数
                    if (!("null".equals(strs[12]) || " ".equals(strs[12]) || "NULL".equals(strs[12]))) {
                        if (Float.parseFloat(strs[12]) >= 0) {
                            limitedNumberQualifiedData++;
                        }
                    }
                    // 待机有功容量
                    if (!("null".equals(strs[13]) || " ".equals(strs[13]) || "NULL".equals(strs[13]))) {
                        if (Float.parseFloat(strs[13]) >= 0) {
                            standbyCapacityQualifiedData++;
                        }
                    }
                    // 待机台数
                    if (!("null".equals(strs[15]) || " ".equals(strs[15]) || "NULL".equals(strs[15]))) {
                        if (Float.parseFloat(strs[15]) >= 0) {
                            standbyNumberQualifiedData++;
                        }
                    }
                    // 通讯中断有功容量
                    if (!("null".equals(strs[16]) || " ".equals(strs[16]) || "NULL".equals(strs[16]))) {
                        if (Float.parseFloat(strs[16]) >= 0) {
                            interruptCapacityQualifiedData++;
                        }
                    }
                    // 通讯中断台数
                    if (!("null".equals(strs[18]) || " ".equals(strs[18]) || "NULL".equals(strs[18]))) {
                        if (Float.parseFloat(strs[18]) >= 0) {
                            interruptNumberQualifiedData++;
                        }
                    }
                    // 非计划停运有功容量
                    if (!("null".equals(strs[19]) || " ".equals(strs[19]) || "NULL".equals(strs[19]))) {
                        if (Float.parseFloat(strs[19]) >= 0) {
                            unplannedCapacityQualifiedData++;
                        }
                    }
                    // 非计划停运台数
                    if (!("null".equals(strs[21]) || " ".equals(strs[21]) || "NULL".equals(strs[21]))) {
                        if (Float.parseFloat(strs[21]) >= 0) {
                            unplannedNumberQualifiedData++;
                        }
                    }
                    // 14.全站实际出力
                    if (!("null".equals(strs[23]) || " ".equals(strs[23]) || "NULL".equals(strs[23]))) {
                        poweraLLQualifiedData++;
                    }
                    // 15.全站可控容量
                    if (!("null".equals(strs[24]) || " ".equals(strs[24]) || "NULL".equals(strs[24]))) {
                        controlCapacityQualifiedData++;
                    }
                    // 16.全站理论有功
                    if (!("null".equals(strs[25]) || " ".equals(strs[25]) || "NULL".equals(strs[25]))) {
                        theoryPowerQualifiedData++;
                    }
                }
                if (line.contains("#") && qxhjCount == 1) {
                    // 17.总辐射
                    if (!("null".equals(strs[2]) || " ".equals(strs[2]) || "NULL".equals(strs[2]))) {
                        if (Float.parseFloat(strs[2]) >= 0) {
                            totalRadioQualifiedData++;
                        }
                    }
                    // 18.直射
                    if (!("null".equals(strs[3]) || " ".equals(strs[3]) || "NULL".equals(strs[3]))) {
                        directRadioQualifiedData++;
                    }
                    // 19.散射
                    if (!("null".equals(strs[4]) || " ".equals(strs[4]) || "NULL".equals(strs[4]))) {
                        scatterRadioQualifiedData++;
                    }
                    // 20.温度
                    if (!("null".equals(strs[6]) || " ".equals(strs[6]) || "NULL".equals(strs[6]))) {
                        if (Float.parseFloat(strs[6]) >= -20 && Float.parseFloat(strs[6]) <= 60) {
                            temperQualifiedData++;
                        }
                    }
                    // 21.压力
                    if (!("null".equals(strs[8]) || " ".equals(strs[8]) || "NULL".equals(strs[8]))) {
                        pressQualifiedData++;
                    }
                    // 22.湿度9
                    if (!("null".equals(strs[9]) || " ".equals(strs[9]) || "NULL".equals(strs[9]))) {
                        if (Float.parseFloat(strs[9]) >= 0 && Float.parseFloat(strs[9]) <= 100) {
                            humidityQualifiedData++;
                        }
                    }
                    // 23.风速10
                    if (!("null".equals(strs[10]) || " ".equals(strs[10]) || "NULL".equals(strs[10]))) {
                        speedQualifiedData++;
                    }
                    // 24.风向11
                    if (!("null".equals(strs[11]) || " ".equals(strs[11]) || "NULL".equals(strs[11]))) {
                        directionQualifiedData++;
                    }
                    // 25.光伏组件温度7
                    if (!("null".equals(strs[7]) || " ".equals(strs[7]) || "NULL".equals(strs[7]))) {
                        if (Float.parseFloat(strs[7]) >= -20 && Float.parseFloat(strs[7]) <= 60) {
                            pvModuleTemperQualifiedData++;
                        }
                    }
                }
            }

            // 1.升压站经度
            dataType = "longitude";
            // 升压站经度不合格
            longitudeUnqualifiedData = 1 - longitudeQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, longitudeNoData, longitudeQualifiedData, longitudeUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 2.升压站纬度
            dataType = "latitude";
            // 升压站纬度不合格
            latitudeUnqualifiedData = 1 - latitudeQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, latitudeNoData, latitudeQualifiedData, latitudeUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 3.正常发电有功容量
            dataType = "normalCapacity";
            // 正常发电有功容量不合格
            normalCapacityUnqualifiedData = 1 - normalCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType,normalCapacityNoData, normalCapacityQualifiedData, normalCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 4.计划检修有功容量
            dataType = "plannedCapacity";
            // 计划检修发电容量不合格
            plannedCapacityUnqualifiedData = 1 - plannedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, plannedCapacityNoData, plannedCapacityQualifiedData, plannedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 5.计划检修台数
            dataType = "plannedNumber";
            // 计划检修台数不合格
            plannedNumberUnqualifiedData = 1 - plannedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, plannedNumberNoData, plannedNumberQualifiedData, plannedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 6.限电有功容量
            dataType = "limitedCapacity";
            // 限电有功容量不合格
            limitedCapacityUnqualifiedData = 1 - limitedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, limitedCapacityNoData, limitedCapacityQualifiedData, limitedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 7.限电台数
            dataType = "limitedNumber";
            // 限电台数不合格
            limitedNumberUnqualifiedData = 1 - limitedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, limitedNumberNoData, limitedNumberQualifiedData, limitedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 8.待机有功容量
            dataType = "standbyCapacity";
            // 待机有功容量不合格
            standbyCapacityUnqualifiedData = 1 - standbyCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, standbyCapacityNoData, standbyCapacityQualifiedData, standbyCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 9.待机台数
            dataType = "standbyNumber";
            // 待机台数不合格
            standbyNumberUnqualifiedData = 1 - standbyNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, standbyNumberNoData, standbyNumberQualifiedData, standbyNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 10.通讯中断容量
            dataType = "interruptCapacity";
            // 通讯中断容量不合格
            interruptCapacityUnqualifiedData = 1 - interruptCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, interruptCapacityNoData, interruptCapacityQualifiedData, interruptCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 11.通讯中断台数
            dataType = "interruptNumber";
            // 通讯中断台数不合格
            interruptNumberUnqualifiedData = 1 - interruptNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, interruptNumberNoData, interruptNumberQualifiedData, interruptNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 12.非计划停运有功容量
            dataType = "unplannedCapacity";
            // 非计划停运有功容量不合格
            unplannedCapacityUnqualifiedData = 1 - unplannedCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, unplannedCapacityNoData, unplannedCapacityQualifiedData, unplannedCapacityUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 13.非计划停运台数
            dataType = "unplannedNumber";
            // 非计划停运台数不合格
            unplannedNumberUnqualifiedData = 1 - unplannedNumberQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, unplannedNumberNoData, unplannedNumberQualifiedData, unplannedNumberUnqualifiedData);
            dataList.add(fileDataCheckEntity);

            // 14.全站实时出力
            dataType = "poweraLL";
            // 全站实时出力不合格
            poweraLLQualifiedDataNo = 1 - poweraLLQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, poweraLLNoData, poweraLLQualifiedData, poweraLLQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 15.全站可控容量
            dataType = "controlCapacity";
            // 全站可控容量不合格
            controlCapacityQualifiedDataNo = 1 - controlCapacityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, controlCapacityNoData, controlCapacityQualifiedData, controlCapacityQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 16.全站理论有功
            dataType = "theoryPower";
            // 全站实时出力不合格
            theoryPowerQualifiedDataNo = 1 - theoryPowerQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, theoryPowerNoData, theoryPowerQualifiedData, theoryPowerQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 17.总辐射
            dataType = "totalRadio";
            // 全站实时出力不合格
            totalRadioQualifiedDataNo = 1 - totalRadioQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, totalRadioNoData, totalRadioQualifiedData, totalRadioQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 18.直射
            dataType = "directRadio";
            // 不合格
            directRadioQualifiedDataNo = 1 - directRadioQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, directRadioNoData, directRadioQualifiedData, directRadioQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 19.散射
            dataType = "scatterRadio";
            // 不合格
            scatterRadioQualifiedDataNo = 1 - scatterRadioQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, scatterRadioNoData, scatterRadioQualifiedData, scatterRadioQualifiedDataNo);
            dataList.add(fileDataCheckEntity);


            // 20.温度
            dataType = "temper";
            // 全站实时出力不合格
            temperQualifiedDataNo = 1 - temperQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, temperNoData, temperQualifiedData, temperQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 21.压力
            dataType = "press";
            // 全站实时出力不合格
            pressQualifiedDataNo = 1 - pressQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, pressNoData, pressQualifiedData, pressQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 22.湿度
            dataType = "humidity";
            // 全站实时出力不合格
            humidityQualifiedDataNo = 1 - humidityQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, humidityNoData, humidityQualifiedData, humidityQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 23.风速
            dataType = "speed";
            // 全站实时出力不合格
            speedQualifiedDataNo = 1 - speedQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, speedNoData, speedQualifiedData, speedQualifiedDataNo);
            dataList.add(fileDataCheckEntity);


            // 24.风向
            dataType = "direction";
            // 全站实时出力不合格
            directionQualifiedDataNo = 1 - directionQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, directionNoData, directionQualifiedData, directionQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            // 25.光伏组件温度
            dataType = "pvModuleTemper";
            // 全站实时出力不合格
            pvModuleTemperQualifiedDataNo = 1 - pvModuleTemperQualifiedData;
            fileDataCheckEntity = DataUtil.getFileDataCheckEntity(plantId, forecastDate, createDate, plantType, fileType, dataType, pvModuleTemperNoData, pvModuleTemperQualifiedData, pvModuleTemperQualifiedDataNo);
            dataList.add(fileDataCheckEntity);

            int data = fileDataCheckMapper.selectFileDataCheck(plantId, forecastDate, tableName);
            if (data == 0) {
                log.info("数据评分插入--------------"+fileName);
                fileDataCheckMapper.insertFileDataCheck(dataList, tableName);
            }

        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            IoUtil.close(br);
            IoUtil.close(fr);
        }
    }

}
